package com.se.contextMenu;

import com.se.common.User;
import com.se.mainView.MainViewController;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.MenuItem;

public class GroupUserContextMenu {
    private GroupUserContextMenu(){
    }

    public static ContextMenu createGroupUserContextMenu(User user) {
        ContextMenu contextMenu = new ContextMenu();

        MenuItem AtItem = new MenuItem("@TA");
        AtItem.setOnAction(event -> MainViewController
                .getInstance().addAtMessage(user.getUserName()));

        MenuItem chatItem = new MenuItem("和TA聊天");
        chatItem.setOnAction(e -> MainViewController.getInstance().chatWith(user));
        //总感觉有点问题，所以下面这段不加了
//        if(!(user instanceof AIUser)) {
//            contextMenu.getItems().add(chatItem);
//        }

        contextMenu.getItems().add(AtItem);
        return contextMenu;
    }
}
